﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <title>登录系统</title>
    <meta charset="utf-8" />
    <link href="@Url.Content("~/Content/css/login.css")" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="~/Content/easyui/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/easyui/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/Css/default.css" />
    <script src="~/Content/easyui/jquery.min.js"></script>
    <script src="~/Content/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            document.onkeydown = function (e) {
                var ev = document.all ? window.event : e;
                if (ev.keyCode == 13) {
                    loginfun();
                }
            }

            $("#btnLogin").click(function () {
                loginfun();
            });

        });

        function loginfun() {
            if ($("#username").val().length <= 0) {
                $.messager.alert('提示消息', '请输入用户名', 'error');
                return false;
            }
            else if ($("#userpass").val().length <= 0) {
                $.messager.alert('请输入密码', '提示消息', 'error');
                return false;
            }
            var pwin;
            $.ajax({
                type: 'post',
                dataType: 'text',
                url: '@Url.Content("~/Login/Login")',
                data: { UserName: $("#username").val(), Password: $("#userpass").val() },
                success: function (result) {

                    if (eval(result) == "true") {
                        location.href = "@Url.Content("~/Manage/Index")";
                    }
                    else {

                        if (eval(result) == "false") {
                            $.messager.alert('登陆失败,用户名或密码', '提示消息', 'error');
                            $("#username").focus();
                        }
                        return;
                    }

                },
                error: function (d, c, e) {
                    $.messager.alert('发送系统错误,请与系统管理员联系' + e, '提示消息', 'error');
                },
                beforeSend: function () {
                    pwin= $.messager.progress({title:'稍等...',msg:'登录中...'});

                    $("#btnLogin").attr("disabled", true);
                },
                complete: function () {
                    $.messager.progress('close');
                    $("#btnLogin").attr("disabled", false);
                }
            });
    }
    </script>
</head>
<body>
    <div class="header">
        <div class="logo">
            <label style="font-size:30px;color:white;">自助考核系统登录</label>
        </div>
    </div>
    <div class="login_all">
        <div class="fl login_left">
            <div class="input_all fl">
                <div class="input_nr">
                    <div class="user_title">用户登录</div>
                    <div class="input">
                        <input class="input_kuang username" name="name" id="username" placeholder="用户名" type="text" maxlength="24" />
                        <span class="error" style="display: none;"></span>
                    </div>
                    <div class="input">
                        <input class=" input_kuang password" name="name" id="userpass" placeholder="密码" type="password" maxlength="24" />
                        <span class="error" style="display: none;">您输入的账户名和密码不匹配，请重新输入</span>
                    </div>
                    <div class="login_enter">
                        <input class=" input_kuang enter" name="submit" id="btnLogin" type="submit" value="登录" />
                    </div>
                </div>
            </div>

        </div>
    </div>
</body>
</html>
